import * as VueRouter from 'vue-router'

// 1. Define route components.
const routes = [
  {
    path: '/404',
    component: () => import('@v/404.vue'),
    hidden: true,
  },
  {
    path: '/login',
    component: () => import('@v/login/index.vue'),
    hidden: true,
  },
  {
    path: '/',
    component: () => import('@/components/layout/homelayout/index.vue'),
    redirect: '/home',
    meta: { title: '首页', icon: 'mdi-home' },
    children: [
      {
        path: '/home',
        component: () => import('@v/home/HomePage.vue'),
      },
      {
        path: '/animesummary/:id',
        component: () => import('@v/home/AnimeSummaryPage.vue'),
      },
    ],
  },
  {
    path: '/settings',
    component: () => import('@/components/layout/homelayout/index.vue'),
    meta: { title: '设置', icon: 'mdi-cog' },
    children: [
      {
        path: '/settings/',
        component: () => import('@v/settings/index.vue'),
      },
    ],
  },
  {
    path: '/logout',
    component: () => import('@/components/layout/homelayout/index.vue'),
    meta: { title: '登出', icon: 'mdi-logout' },
  },
]

export const router = VueRouter.createRouter({
  history: VueRouter.createWebHashHistory(),
  routes,
  scrollBehavior() {
    return { top: 0 }
  },
})

export default router
